
\documentclass[a4paper]{article}
\usepackage{pgfplots}
\usepackage{pgfplots.assert}

\begin{document}

\makeatletter

{
	\pgfkeysdefargs{/pgfplots/iflessthan}{#1#2#3#4}{%
		\ifnum#1<#2\relax #3\else #4\fi
	}%
	\pgfplotsarraynew\subject{1}

	\pgfplotsarraybinarysearch\subject{0}{0}{\pgfplotsarraysizeof\subject}
	\pgfplotsassertequalstok{-1}{\pgfplotsretval}{}%

	\pgfplotsarraybinarysearch\subject{1}{0}{\pgfplotsarraysizeof\subject}
	\pgfplotsassertequalstok{0}{\pgfplotsretval}{}%

	\pgfplotsarraybinarysearch\subject{2}{0}{\pgfplotsarraysizeof\subject}
	\pgfplotsassertequalstok{-2}{\pgfplotsretval}{}%
}

{
	\pgfkeysdefargs{/pgfplots/iflessthan}{#1#2#3#4}{%
		\ifnum#1<#2\relax #3\else #4\fi
	}%
	\pgfplotsarraynew\subject{1,10}

	\pgfplotsarraybinarysearch\subject{0}{0}{\pgfplotsarraysizeof\subject}
	\pgfplotsassertequalstok{-1}{\pgfplotsretval}{}%

	\pgfplotsarraybinarysearch\subject{1}{0}{\pgfplotsarraysizeof\subject}
	\pgfplotsassertequalstok{0}{\pgfplotsretval}{}%

	\pgfplotsarraybinarysearch\subject{2}{0}{\pgfplotsarraysizeof\subject}
	\pgfplotsassertequalstok{-2}{\pgfplotsretval}{}%

	\pgfplotsarraybinarysearch\subject{10}{0}{\pgfplotsarraysizeof\subject}
	\pgfplotsassertequalstok{1}{\pgfplotsretval}{}%
}

{
	\pgfkeysdefargs{/pgfplots/iflessthan}{#1#2#3#4}{%
		\ifdim#1 pt<#2 pt\relax #3\else #4\fi
	}%
	\pgfplotsarraynew\subject{0.5,1,10.5,1000.5}

	\pgfplotsarraybinarysearch\subject{2}{0}{\pgfplotsarraysizeof\subject}
	\pgfplotsassertequalstok{-3}{\pgfplotsretval}{}%

	\pgfplotsarraybinarysearch\subject{10.5}{0}{\pgfplotsarraysizeof\subject}
	\pgfplotsassertequalstok{2}{\pgfplotsretval}{}%

	\pgfplotsarraybinarysearch\subject{2000}{0}{\pgfplotsarraysizeof\subject}
	\pgfplotsassertequalstok{-5}{\pgfplotsretval}{}%

	\pgfplotsarraybinarysearch\subject{1000.5}{0}{\pgfplotsarraysizeof\subject}
	\pgfplotsassertequalstok{3}{\pgfplotsretval}{}%
}

\end{document}
